import request from '@/utils/request';

/**
 * 查询
 * @param currentPage 当前页
 */
export async function query({ currentPage }) {
  return request('/api/getRolePageList', {
    params: { page: currentPage }
  });
}
/**
 * 保存
 * @param role 角色对象
 */
export async function save({ role }) {
  return request('/api/saveRole', {
    method: 'POST',
    data: role
  })
}
/**
 * 删除
 * @param id  标识
 */
export async function del({ id }) {
  return request('/api/deleteRole', {
    params: { id: id }
  })
}
/**
 * 根据角色id获得对应的权限
 * @param id 角色ID
 */
export async function getPermissionByRoleId({id}){
  return request('/api/getPermissionByRoleId',{
    params: { id: id}
  })
}

/**
 * 根据角色id 保存新的权限
 * @param {*} param0
 */
export async function saveNewPermissionsByRoleId({ newPermissions,id}){
  return request('/api/saveNewPermissionsByRoleId',{
    method: 'POST',
    data: {
      newPermissions,
      id
    }
  })
}
